<template>
  <ul class="catagtory">
    <li
      :class="{ select: classSty === item.id }"
      v-for="item in navList"
      :key="item.id"
      @click="changeSty(item.id)"
    >
      {{ item.name }}
    </li>
  </ul>
</template>

<script>
import { mapActions, mapState } from 'vuex'
export default {
  created () {
    this.getNavList()
    console.log(this.navList)
  },
  computed: {
    ...mapState('type', ['navList', 'classSty'])
  },
  methods: {
    ...mapActions('type', ['getNavList']),
    ...mapActions('list', ['getMsgList']),
    changeSty (id) {
      this.$store.commit('type/setClassSty', id)
      this.getMsgList(id)
    }
  }
}
</script>

<style>
</style>
